#include <iostream>
#include <cstring>
#include <string>

using namespace std;

typedef long long int64;

int	main()
{
	int T;
	cin >> T;
	while (T--)
	{
		cin >> G >> B >> P;
		memset(a, 0, sizeof(a));
		for (int i = 0; i < G; ++i)
			for (int j = 0; j < B; ++j)
				cin >> a[i][G + j];
		for (int i = 0; i < B; ++i)
			for (int j = 0; j < P; ++j)
				cin >> a[i][G + j];
	}
	return 0;
}